package Class_04_12;

class Dog
{
    private String name;

    public Dog() {
    }

    public Dog(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

abstract class person
{
    private String name;

    abstract void feed(Dog dog);

    public person() {
    }

    public person(String name) {
        this.name = name;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}

class master extends person
{
    public master() {
    }

    public master(String name) {
        super(name);
    }

    void feed(Dog dog)
    {
        System.out.println(getName() + "喂" + dog.getName() + "时：");
        System.out.println(dog.getName() + "很开心的欢跳");
    }
}

class family extends person
{
    public family() {
    }

    public family(String name) {
        super(name);
    }

    void feed(Dog dog)
    {
        System.out.println(getName() + "喂" + dog.getName() + "时：");
        System.out.println(dog.getName() + "很平常的吃东西");
    }
}

class stranger extends person
{
    public stranger() {
    }

    public stranger(String name) {
        super(name);
    }

    void feed(Dog dog)
    {
        System.out.println(getName() + "喂" + dog.getName() + "时：");
        System.out.println(dog.getName() + "会很有警惕，并发出叫声");
    }
}
public class Main3 {
    public static void main(String[] args) {
        Dog dog = new Dog("旺财");
        master person1 = new master("主人");
        family person2 = new family("家人");
        stranger person3 = new stranger("陌生人");

        person1.feed(dog);
        person2.feed(dog);
        person3.feed(dog);
    }
}
